﻿using System;
using System.Windows.Input;

namespace MvvmHelper
{
    /// <summary>
    /// CanExcute の実装とかほぼ定型文なので。
    /// </summary>
    public abstract class CommandBase : ICommand
    {
        public virtual bool CanExecute(object parameter)
        {
            return true;
        }

        public abstract void Execute(object parameter);

        public event EventHandler CanExecuteChanged;

        public void OnCanExecuteChanged()
        {
            var c = CanExecuteChanged;
            if (c != null)
                c(this, null);
        }
    }
}
